vcConnector

vcConnector allows you to establish connections between behaviors in order to transfer components. For example, flow type behaviors may have any number of connections (ports/connectors) to manage the receiving and sending of components.

See in: Overview

Module: vcCore

Parent: vcObject

Children -

Referenced by: vcComponentFlowProxy.createConnector(), vcComponentFlowProxy.getInternalConnector()

Properties

Learn how to use properties here. The properties are also inherited from the parent class.

NameTypeAccessDescription
BehaviorvcBehaviorRGets the behavior that the connector is connected to in a component.
If no connection, the value is None.
CapacityTestvcConnectorTestLocationRWGets or sets the mode for testing capacity before transferring a component to an outgoing connection.
ConnectionvcConnectorRWGets or sets connector that the connector is connected to in a component.
If no connection, the value is None.
IndexIntegerRGets the position of the connector in its behavior's list of connectors.
NameStringRWGets or sets the name of connector.
TypevcConnectorTypeRWGets or sets the connector's type.

Methods

Learn how to use methods here. The methods are also inherited from the parent class.

NameReturn TypeParametersDescription
connectNonevcConnector OR None connectorConnects the connector to a given connector.
See more
If no argument is given, this method will remove all connections of the connector.

Parameters:
connector (vcConnector): Connector to connect to.
testCapacityBooleanvcComponent argTests if the owner behavior has capacity for a component.
See more
Parameters:
component (vcComponent): Component entering this port.

Returns:
bool: True if component can enter this port, otherwise False.

Exceptions:
ArgumentError: When given vcComponent is not a valid instance.
testConnectedCapacityBooleanvcComponent argTests if connected connector's owner has capacity for a component.
See more
Parameters:
component (vcComponent): Component entering this port.

Returns:
bool: True if component can enter this port, otherwise False.

Exceptions:
RuntimeError: When connected owner is not connected to another vcConnector.
ArgumentError: When given vcComponent is not a valid instance.

Example: Access and Connect Path Connectors

"""Example how to access and connect the paths inside the same component to each other using connectors"""

import vcCore as vc

async def OnRun():
  comp = vc.getComponent()
  path1 = comp.findBehavior('Path1')
  path2 = comp.findBehavior('Path2')

  #access container“s specific connector from list of connectors
  outConnector = [x for x in path1.Connectors if x.Name == "Output"][0]
  
  #access container“s connector from the list of connectors with index
  inConnector = path2.Connectors[0]
  
  #connect Path1 output to Path2 input
  outConnector.connect( inConnector )